package com.ilink.dataanalysis.controller;

import com.ilink.dataanalysis.service.CourseSourceService;
import com.ilink.ilinkcommon.domain.R;
import com.ilink.ilinkcommon.log.method.MethodLog;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/dataanalysis")
@RequiredArgsConstructor
public class CourseController {

    private final CourseSourceService courseSourceService;

    @MethodLog("获取过去30天课程资源播放量")
    @PostMapping("/getCourseSourceAccessInfo")
    public R getCourseSourceAccessInfo(){
        try {
            return courseSourceService.getCourseSourceAccessInfo();
        } catch (Exception e) {
            return R.error("内部服务器错误：" + e.getMessage());
        }
    }

}
